🍗 Wiki

Linux Kernel Driver

Linux Kernel Driver

This document demonstrates how to make and hack a simple Linux kernel module, a character device driver for example.

2. Build

obj-m += sample.o // name of your driver

all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

5. References

  • Elixir Bootin y’all know it is fantastic linux code explorer. But if you want to know which headers should be included to use the functions, you can search them at Elixir Bootin. It will tell you which header has its definition.